package service.impl;

import java.util.List;

import pojo.Merchant;
import service.MerchantManager;
import dao.MerchantDao;
import dao.factory.DaoFactory;

public class MerchantManagerImpl implements MerchantManager {
	
	private MerchantDao merchantDao;
	
	public MerchantManagerImpl(){
		merchantDao = DaoFactory.getMerchantDaoInstance();
	}
	
	@Override
	public List<Merchant> getAllMerchant() {
		return merchantDao.findAll();
	}

	@Override
	public Merchant getMerchant(String id) {
		return merchantDao.load(id);
	}

	@Override
	public List<Merchant> getMerchantsByStatus(String status) {
		return merchantDao.findByStatus(status);
	}

	@Override
	public Merchant getMerchantByName(String name) {
		return merchantDao.loadByName(name);
	}

	@Override
	public int updateMerchant(Merchant merchant) {
		return merchantDao.update(merchant);
	}

	@Override
	public int addMerchant(Merchant merchant) {
		return merchantDao.add(merchant);
	}

}
